home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln0885.arc
/
CROSS3.LTG
< prev
next >
Wrap
Text File
|
1986-02-27
|
2KB
|
51 lines
crossthoughts Listinτá 3.
PP╠ codσ fo≥ modified¼ least-frequently-useΣ (MLFU⌐ pagσ ì
replacemen⌠ function
FUNCTION Selected_Page() return integer
-- Critical_Timσ i≤ se⌠ a≤ ß criterioε fo≥ givinτ recentl∙ reaΣ ì
page≤ ß seconΣ chancσ fo≥ staying« I⌠ mus⌠ bσ systematicall∙ ì
updateΣ by other program segments.
-- The modified Table_Type is
-- Table_Type = RECORD RAM_Page, Dirty_bit, Frequency : integer;
Time : Time_Units END
BEGIN
IF Found
THEN -- when sought page is RAM-resident
Table[i].Frequency += 1
return ()
ELSE
INITIALIZE: Pick = 1
LOOP <Start_Up>
BEGIN For j = 1 to Table_Size
IF Critical_Time > Table[j].Time
THEN Least_Frequent = Table[j].Frequency
Pick = j
EXIT <Start_Up>
END IF
END LOOP <Start_Up>
TERMINATE: None
INITIALIZE: Least_Frequent = Table[Pick].Frequency
Pointer = Pick; j = Pick + 1
LOOP <Search>
BEGIN IF j > Table_Size THEN EXIT <Search> END IF
IF Least_Frequent > Table[j].Frequency AND
Critical_Time > Table[j].Time
THEN Least_Frequent = Table[j].Frequency
Pointer = j
ELSE j += 1
END IF
END LOOP <Search>
-- Prepare frequency count for new page
TERMINATE: Table[Pointer].Frequency = 1
return( Pointer )
END IF
END Selected_Page